import logging


def use_logging(level):
    def decorator(func):
        def warpper(*args, **kwargs):
            if level == 'warn':
                logging.warn("%s is running" % func.__name__)
            return func(*args)

        return warpper
    return decorator


@use_logging(level="warn")
def foo(name="foo"):
    print("i am %s" % name)


foo()
